function e(e, a, t) {
    return a in e ? Object.defineProperty(e, a, {
        value: t,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[a] = t, e;
}

var a, t = getApp(), i = require("filterCommon.js");

require("../../utils/md5.min.js");

Page({
    data: (a = {
        selected: 5,
        tabArr: {
            curHdIndex: 0,
            curEdIndex: 0,
            curSdIndex: 0,
            curLdIndex: 0
        },
        scrollTop: {
            scroll_top: 0,
            goTop_show: !1
        },
        cur: "",
        showDialog: !1,
        loading: !1,
        pull: !0,
        windowHeight: 736,
        showLoading: !0,
        value: [ 0, 0 ],
        ul_areas: [],
        price: [],
        avg_price: [],
        house_type: [],
        house_zhuangxiu: [],
        brandbox: [],
        tag: [],
        house_is_register: [],
        house_house_type: [],
        listorder: [],
        district: [],
        subway: [],
        areas: [],
        citys: [],
        stations: [],
        station: "",
        bangongtype: 0,
        zhuangxiutype: 0,
        saas_comp_id: 0,
        ordertype: 0,
        building_items: []
    }, e(a, "areas", ""), e(a, "nohouse", !1), e(a, "msg_template", ""), e(a, "pages", 1), 
    e(a, "maxPage", 1), e(a, "subsucc", !1), e(a, "street_name", {}), e(a, "circle_id", ""), 
    e(a, "cityOption", {}), e(a, "isloading", !1), e(a, "imgurls", [ {
        url: "../../images/AllAble_icon.png",
        id: 0
    }, {
        url: "../../images/Ordinary_icon.png",
        id: 1
    }, {
        url: "../../images/Hardcover_icon.png",
        id: 5
    }, {
        url: "../../images/Secondary_icon.png",
        id: 6
    } ]), e(a, "building", {}), e(a, "building_list", {}), e(a, "pointInfo", {}), e(a, "searchobj", {
        house_type: 0,
        house_zhuangxiu: 0,
        saas_comp_id: 0,
        house_is_register: 0
    }), e(a, "order", {}), e(a, "filter", {}), e(a, "buildCard", []), e(a, "buildCard", ""), 
    e(a, "cardBuilding", !1), e(a, "buildCardbox", !1), e(a, "keyword", ""), e(a, "filterPosition", "位置"), 
    e(a, "filterArea", "面积"), e(a, "filterPrice", "价格"), e(a, "filterAll", ""), e(a, "districtname", ""), 
    e(a, "subwayall", ""), e(a, "subwayline", ""), e(a, "avgprice", ""), e(a, "totleprice", ""), 
    e(a, "inputValue", ""), a),
    clickTypeFun: i.clickTypeFun,
    clickTypeZX: i.clickTypeZX,
    clickBrand: i.clickBrand,
    filterFun: i.filterFun,
    clickTypeTS: i.clickTypeTS,
    clickTypeClear: i.clickTypeClear,
    tabFun: i.tabFun,
    tabFunlab: i.tabFunlab,
    showFn: function() {
        var e = this;
        if ("" == e.data.buildCard) wx.makePhoneCall({
            phoneNumber: e.data.msg_template
        }); else {
            var a = this.data.buildCard.employee_info.phone.replace("转", ",");
            wx.makePhoneCall({
                phoneNumber: a
            });
        }
    },
    showFnA: function(e) {
        var a = this.data.buildCard.employee_info.phone.replace("转", ",");
        wx.makePhoneCall({
            phoneNumber: a
        });
    },
    selectedFun: function(e) {
        var a = e.target.dataset.val;
        this.data.selected == a && (a = -1), this.setData({
            selected: a
        });
    },
    scrollTopFun: function(e) {
        e.detail.scrollTop > 300 ? this.setData({
            "scrollTop.goTop_show": !0
        }) : this.setData({
            "scrollTop.goTop_show": !1
        });
    },
    upper: function() {
        var e = this, a = t.getSecret();
        if (e.data.isloading) return !1;
        if (e.setData({
            isloading: !0
        }), e.data.pages > e.data.maxPage) return !1;
        e.data.pages++;
        var i = t.extend({
            page: e.data.pages,
            currtime: a.currtime,
            sign: a.sign
        }, e.data.cityOption);
        i = t.extend(i, e.data.filter), i = t.extend(i, e.data.order), wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/house-list/",
            data: i,
            success: function(a) {
                if (e.setData({
                    isloading: !1
                }), 200 === a.data.code) {
                    var t = a.data, i = t.data.list, s = [];
                    for (var r in i) i[r].point_name && (i[r].name = i[r].point_name), s.push(i[r]);
                    var d = e.data.building_items;
                    Array.prototype.push.apply(d, s), e.setData({
                        building_items: d,
                        selected: 5,
                        nohouse: !1,
                        house_show: !0,
                        subsucc: !0,
                        maxPage: Math.ceil(t.total / 10)
                    }), setTimeout(function() {
                        e.setData({
                            subsucc: !1
                        });
                    }, 2e3);
                } else (d = e.data.building_items).length > 0 ? e.setData({
                    house_show: !1
                }) : e.setData({
                    nohouse: !0,
                    house_show: !1,
                    selected: 5
                });
            }
        });
    },
    goTopFun: function(e) {
        var a = this.data.scrollTop.scroll_top;
        a = 1 == a ? 0 : 1, this.setData({
            "scrollTop.scroll_top": a
        });
    },
    onLoad: function(e) {
        var a = this;
        console.log(a);
        var i = t.getSecret(), s = e.searchInfo;
        console.log(s), e.domain = e.domain || t.globalData.domain, a.setData({
            cityOption: e,
            keyword: a.options.keyword || "",
            inputValue: s || ""
        }), wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/getqueryfilter/",
            data: {
                domain: t.globalData.domain,
                currtime: i.currtime,
                sign: i.sign
            },
            success: function(e) {
                var i = e.data;
                console.log(i), i.data.district[0].district_id = i.data.district[0].val, a.setData({
                    ul_areas: i.data.area,
                    price: i.data.price_rent.price,
                    avg_price: i.data.price_rent.avg_price,
                    house_type: i.data.house_type,
                    house_zhuangxiu: i.data.house_zhuangxiu,
                    brandbox: i.data.brand
                });
                var s = function(e) {
                    for (var a = 0; a < e.length; a++) e[a].checked = "不限" === e[a].show;
                };
                s(i.data.house_is_register), s(i.data.house_house_type), s(i.data.tag), a.setData({
                    house_is_register: i.data.house_is_register,
                    house_house_type: i.data.house_house_type,
                    tag: i.data.tag
                }), a.setData({
                    listorder: i.data.houseListorder,
                    district: i.data.district,
                    subway: i.data.subway_line,
                    msg_template: t.globalData["tel-phone"]
                });
            }
        });
        var r = t.extend({
            domain: t.globalData.domain,
            currtime: i.currtime,
            sign: i.sign,
            uuid: wx.getStorageSync("first_code"),
            type: e.type || "",
            keyword: e.keyword || ""
        }, e);
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/house-list/",
            data: r,
            success: function(e) {
                var t = e.data, i = [];
                if (200 == e.data.code) {
                    var s = t.data.list;
                    for (var r in s) i.push(s[r]);
                    0 == t.data.list.length && a.setData({
                        nohouse: !0,
                        house_show: !1
                    });
                }
                var d = t.data.list_card || "";
                0 == d.building.length && 0 == d.employee_info ? a.setData({
                    building_items: i
                }) : a.setData({
                    building_items: i,
                    buildCard: d
                }), "" != d.building && a.setData({
                    cardBuilding: !0,
                    buildCardbox: !0
                });
            }
        }), wx.getSystemInfo({
            success: function(e) {
                a.setData({
                    windowHeight: e.windowHeight
                });
            }
        });
    },
    goTap: function(e) {
        var a = this, i = e.currentTarget.dataset;
        if (i.obj && (i = i.obj), void 0 === i.listorder) {
            var s = a.data.filter;
            console.log(i), void 0 !== i.price && (delete s.avg_price, a.setData({
                totleprice: i.totleprice,
                avgprice: "",
                filterPrice: ""
            })), void 0 !== i.avg_price && (delete s.price, a.setData({
                avgprice: i.avgprice,
                totleprice: "",
                filterPrice: ""
            })), t.extend(i, s, !0), 0 == i.val || 0 == i.lineid ? (delete i.id, delete i.station, 
            delete i.subway_line) : a.setData({
                filter: i
            }), 0 == a.data.filter.circle_id && 0 == i.lineid || 0 == a.data.filter.circle_id && 0 == i.station || 0 == a.data.filter.circle_id && i.station || 0 != a.data.filter.circle_id && 0 == i.lineid && a.data.filter.district_id || 0 != i.circle_id && 0 == i.station && i.district_id || i.circle_id && i.station && i.district_id ? 0 == a.data.filter.circle_id && 0 == i.lineid ? a.setData({
                filterPosition: a.data.districtname + "-" + i.subwayall
            }) : 0 == a.data.filter.circle_id && 0 == i.station ? a.setData({
                filterPosition: a.data.districtname + "-" + a.data.subwayline
            }) : 0 == a.data.filter.circle_id && 0 != i.station ? a.setData({
                filterPosition: a.data.districtname + "-" + i.subwayname
            }) : 0 != a.data.filter.circle_id && 0 == i.lineid && a.data.filter.district_id ? (delete i.subwayname, 
            delete a.data.filter.subway_line, delete a.data.filter.station, a.setData({
                filterPosition: a.data.districtname + "-" + i.circlename
            })) : 0 != i.circle_id && 0 == i.station ? a.setData({
                filterPosition: i.circlename + "-" + a.data.subwayline
            }) : 0 != i.circle_id && 0 != i.station && a.setData({
                filterPosition: i.circlename + "-" + i.subwayname
            }) : 0 == i.allval || 0 == i.circle_id || i.circle_id ? 0 == i.allval ? (delete i.subwayname, 
            delete a.data.filter.subway_line, delete a.data.filter.station, delete i.circlename, 
            delete i.district_id, delete i.circle_id, a.setData({
                filterPosition: i.allname
            })) : 0 == i.circle_id ? a.setData({
                filterPosition: a.data.districtname
            }) : 0 != i.circle_id && a.setData({
                filterPosition: a.data.districtname + "-" + i.circlename
            }) : (0 == i.lineid || 0 == i.station || i.station) && (0 == i.lineid ? (delete i.subwayname, 
            delete a.data.filter.subway_line, delete a.data.filter.station, delete i.circlename, 
            delete i.district_id, delete i.circle_id, a.setData({
                filterPosition: i.subwayall
            })) : 0 == i.station ? a.setData({
                filterPosition: a.data.subwayline
            }) : i.station && a.setData({
                filterPosition: a.data.subwayline + "-" + i.subwayname
            })), i.areas && a.setData({
                filterArea: i.areas
            });
        } else a.setData({
            order: i,
            ordertype: i.listorder
        });
        var r = t.getSecret();
        if (void 0 != a.options.keyword) d = t.extend({
            domain: t.globalData.domain,
            currtime: r.currtime,
            sign: r.sign,
            uuid: wx.getStorageSync("first_code"),
            keyword: a.options.keyword
        }, i); else var d = t.extend({
            domain: t.globalData.domain,
            currtime: r.currtime,
            sign: r.sign,
            uuid: wx.getStorageSync("first_code")
        }, i);
        "0" === d.district_id && (delete d.district_id, delete d.circle_id), "0" === d.subway_line && (delete d.subway_line, 
        delete d.station), wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/house-list/",
            data: d,
            success: function(e) {
                var s = e.data;
                if (0 != e.data.data.list.length) {
                    var r = t.extend(i, a.data.filter);
                    "0" === r.district_id && (delete r.district_id, delete r.circle_id), "0" === r.subway_line && (delete r.subway_line, 
                    delete r.station);
                    var l = e.data, o = l.data.list, n = s.data.list_card || "", c = [];
                    for (var u in o) o[u].point_name && (o[u].name = o[u].point_name), c.push(o[u]);
                    var g = {}, p = [];
                    t.extend(p, a.data.areas), t.extend(g, a.data.tabArr), d.district_id || (g.curSdIndexR = -1, 
                    p = []);
                    var _ = [];
                    t.extend(_, a.data.stations), t.extend(g, a.data.tabArr), d.subway_line || (g.curLdIndexR = -1, 
                    _ = []), 0 == n.building.length && 0 == n.employee_info.length ? a.setData({
                        cardBuilding: !1,
                        buildCardbox: !1
                    }) : "" != n.employee_info && "" != n.building ? a.setData({
                        cardBuilding: !0,
                        buildCardbox: !0,
                        buildCard: n
                    }) : "" != n.employee_info && a.setData({
                        cardBuilding: !1,
                        buildCardbox: !0,
                        buildCard: n
                    }), a.setData({
                        building_items: o,
                        selected: 5,
                        nohouse: !1,
                        house_show: !0,
                        showDialog: !1,
                        maxPage: Math.ceil(l.total / 10),
                        scrollTop: 0,
                        tabArr: g,
                        areas: p,
                        stations: _
                    });
                } else a.setData({
                    building_items: [],
                    nohouse: !0,
                    house_show: !1,
                    selected: 5,
                    showDialog: !1
                });
            }
        });
    },
    directTap: function(e) {
        var a = this, i = e.currentTarget.dataset.id, s = t.globalData.domain, r = t.getSecret();
        this.district_id = e.currentTarget.dataset.id;
        var d = e.currentTarget.dataset.districtname;
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/getqueryfilter/",
            data: {
                district_id: i,
                domain: s,
                currtime: r.currtime,
                sign: r.sign
            },
            success: function(e) {
                a.setData({
                    areas: e.data.data,
                    districtname: d
                });
            }
        });
    },
    ditieTap: function(e) {
        var a = this, i = e.currentTarget.dataset.id, s = t.globalData.domain, r = t.getSecret();
        this.subway_line = e.currentTarget.dataset.id;
        var d = e.currentTarget.dataset.subwayline;
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/getqueryfilter/",
            data: {
                subway_line: i,
                domain: s,
                currtime: r.currtime,
                sign: r.sign
            },
            success: function(e) {
                a.setData({
                    stations: e.data.data.station,
                    subwayline: d
                });
            }
        });
    },
    onClickButton: function(e) {
        var a = this;
        switch (e.currentTarget.dataset.index) {
          case "0":
            a.setData({
                showDialog: !this.data.showDialog
            });
        }
    },
    onClickdiaView: function() {
        this.setData({
            showDialog: !this.data.showDialog
        });
    },
    closeFun: function() {
        this.setData({
            selected: 5,
            showDialog: 0
        });
    },
    emptyFun: function() {}
});